<form class="layui-form">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body">
                    <h1 class="custom-company-new_title">客户基础信息</h1>
                    <div class="layui-row">
                        <div class="layui-col-md6">
                            <div class="layui-row layui-col-space10 layui-form-item">
                                <div class="layui-col-md10">
                                    <label class="layui-form-label"><i class="red margin-right-4">*</i>企业海关编码：</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="Number" value="@{{ .m.Number }}" lay-verify="required"
                                               lay-verType="tips" placeholder="输入10位企业海关编码，必填" autocomplete="off"
                                               class="layui-input" maxlength="10">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-row layui-col-space10 layui-form-item">
                                <div class="layui-col-md10">
                                    <label class="layui-form-label">企业简称：</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="Short" value="@{{ .m.Short }}"
                                               placeholder="输入客户企业的简称，字符不限" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-row layui-col-space10 layui-form-item">
                                <div class="layui-col-md10">
                                    <label class="layui-form-label">地址：</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="Address" value="@{{ .m.Address }}"
                                               placeholder="输入客户的的详细地址，字符不限" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-row layui-col-space10 layui-form-item">
                                <div class="layui-col-md10">
                                    <label class="layui-form-label">客户电话：</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="Phone" value="@{{ .m.Phone }}" placeholder="输入客户电话号码"
                                               autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-row layui-col-space10 layui-form-item">
                                <div class="layui-col-md10">
                                    <label class="layui-form-label">企业产地证注册号：</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="RegistrationCode" value="@{{ .m.RegistrationCode }}"
                                               placeholder="输入客户的企业产地证注册号" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-row layui-col-space10 layui-form-item">
                                <div class="layui-col-md10">
                                    <label class="layui-form-label">经营单位名称：</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="BusinessName" value="@{{ .m.BusinessName }}"
                                               placeholder="输入客户的经营单位名称" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-row layui-col-space10 layui-form-item">
                                <div class="layui-col-md10">
                                    <label class="layui-form-label">银行账户：</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="Bank" value="@{{ .m.Bank }}"
                                               placeholder="输入客户的银行账户，不超过20个字符" autocomplete="off" class="layui-input"
                                               maxlength="20">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-row layui-col-space10 layui-form-item">
                                <div class="layui-col-md10">
                                    <label class="layui-form-label">企业类别：</label>
                                    <div class="layui-input-block" id="company_type">
                                        <select name="CompanyType" lay-filter="company_type">
                                            <option value="">请选择</option>
                                            <option value="全部">全部</option>
                                            <option @{{if compare  "0" .m.CompanyType  }} selected @{{end}} value="0">
                                                往来客户
                                            </option>
                                            <option @{{if compare  "1" .m.CompanyType  }} selected @{{end}} value="1">
                                                保税仓
                                            </option>
                                            <option @{{if compare  "2" .m.CompanyType  }} selected @{{end}} value="2">
                                                供应商
                                            </option>
                                            <option @{{if compare  "3" .m.CompanyType  }} selected @{{end}} value="3">
                                                代理报关公司
                                            </option>
                                            <option @{{if compare  "4" .m.CompanyType  }} selected @{{end}} value="4">
                                                代理报检公司
                                            </option>
                                            <option @{{if compare  "5" .m.CompanyType  }} selected @{{end}} value="5">
                                                物流公司
                                            </option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-row layui-col-space10 layui-form-item">
                                <div class="layui-col-md10">
                                    <label class="layui-form-label">风控评级：</label>
                                    <div class="layui-input-block">
                                        <div id="control_rating"></div>
                                    </div>
                                    <input type="hidden" name="ControlRating">
                                </div>
                            </div>
                        </div>

                        <div class="layui-col-md6">
                            <div class="layui-row layui-col-space10 layui-form-item">
                                <div class="layui-col-md10">
                                    <label class="layui-form-label"><i class="red margin-right-4">*</i>企业全称：</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="Name" value="@{{ .m.Name}}" lay-verify="required"
                                               lay-verType="tips" placeholder="输入客户企业的全称，字符不限，必填" autocomplete="off"
                                               class="layui-input">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-row layui-col-space10 layui-form-item">
                                <div class="layui-col-md10">
                                    <label class="layui-form-label"><i class="red margin-right-4">*</i>企业商检注册号：</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="Registration" value="@{{ .m.Registration}}"
                                               lay-verify="required"
                                               lay-verType="tips" placeholder="输入客户的10位商检注册号" autocomplete="off"
                                               class="layui-input" maxlength="10">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-row layui-col-space10 layui-form-item">
                                <div class="layui-col-md10">
                                    <label class="layui-form-label">申报方式：</label>
                                    <div class="layui-input-block" id="declare_type">
                                        <select name="DeclareType" lay-filter="declare_type">
                                            <option value="">请选择</option>
                                            <option @{{if compare  "0" .m.DeclareType  }} selected @{{end}} value="0">
                                                代理
                                            </option>
                                            <option @{{if compare  "1" .m.DeclareType  }} selected @{{end}} value="1">
                                                自理
                                            </option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-row layui-col-space10 layui-form-item">
                                <div class="layui-col-md10">
                                    <label class="layui-form-label">客户传真号码：</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="Fax" value="@{{ .m.Fax}}" placeholder="输入传真号码"
                                               autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-row layui-col-space10 layui-form-item">
                                <div class="layui-col-md10">
                                    <label class="layui-form-label"><i class="red margin-right-4">*</i>企业信用代码：</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="CreditCode" value="@{{ .m.CreditCode}}"
                                               lay-verify="required" lay-verType="tips" placeholder="输入客户的18位企业信用代码"
                                               autocomplete="off"
                                               class="layui-input" maxlength="18">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-row layui-col-space10 layui-form-item">
                                <div class="layui-col-md10">
                                    <label class="layui-form-label">经营单位代码：</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="BusinessCode" value="@{{ .m.BusinessCode}}"
                                               placeholder="输入客户的10位经营单位代码" autocomplete="off" class="layui-input"
                                               maxlength="10">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-row layui-col-space10 layui-form-item">
                                <div class="layui-col-md10">
                                    <label class="layui-form-label">企业海关认证：</label>
                                    <div class="layui-input-block">
                                        <select name="CustomCertification" lay-filter="custom_certification">
                                            <option value="">请选择</option>
                                            <option @{{if compare  "0" .m.DeclareType  }} selected @{{end}} value="0">
                                                高级认证
                                            </option>
                                            <option @{{if compare  "1" .m.DeclareType  }} selected @{{end}} value="1">
                                                一般认证
                                            </option>
                                            <option @{{if compare  "2" .m.DeclareType  }} selected @{{end}} value="2">
                                                一般信用
                                            </option>
                                            <option @{{if compare  "3" .m.DeclareType  }} selected @{{end}} value="3">
                                                失信企业
                                            </option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-row layui-col-space10 layui-form-item">
                                <div class="layui-col-md10">
                                    <label class="layui-form-label">企业性质：</label>
                                    <div class="layui-input-block">
                                        <select name="CompanyKind" lay-filter="company_kind">
                                            <option value="">请选择</option>
                                            <option @{{if compare  "0" .m.DeclareType  }} selected @{{end}} value="0">
                                                国有
                                            </option>
                                            <option @{{if compare  "1" .m.DeclareType  }} selected @{{end}} value="1">
                                                合作
                                            </option>
                                            <option @{{if compare  "2" .m.DeclareType  }} selected @{{end}} value="2">
                                                合资
                                            </option>
                                            <option @{{if compare  "3" .m.DeclareType  }} selected @{{end}} value="3">
                                                独资
                                            </option>
                                            <option @{{if compare  "4" .m.DeclareType  }} selected @{{end}} value="4">
                                                集体
                                            </option>
                                            <option @{{if compare  "5" .m.DeclareType  }} selected @{{end}} value="5">
                                                私营
                                            </option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-row layui-col-space10 layui-form-item">
                                <div class="layui-col-md10">
                                    <label class="layui-form-label">默认跟单人：</label>
                                    <div class="layui-input-block">
                                        <select name="BackendUserId" lay-filter="user_id" lay-search>
                                            <option value="">请选择</option>
                                            @{{ range .backendUsers }}
                                        @{{ if $.m.BackendUser }}
                                        @{{ if eq $.m.BackendUser.Id .Id }}
                                        <option selected value="@{{ .Id }}">@{{ .RealName}}</option>
                                        @{{ else}}
                                        <option value="@{{ .Id }}">@{{ .RealName}}</option>
                                        @{{ end}}
                                        @{{ else}}
                                        <option value="@{{ .Id }}">@{{ .RealName}}</option>
                                        @{{ end}}

                                        @{{ end}}
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="layui-row layui-col-space10 layui-form-item">
                        <div class="layui-col-md11">
                            <label class="layui-form-label">备注：</label>
                            <div class="layui-input-block">
                                <textarea name="Remark" placeholder="请输入"
                                          class="layui-textarea">@{{ .m.Remark }}</textarea>
                            </div>
                        </div>
                    </div>

                    <h1 class="custom-company-new_title"></h1>
                    <div class="layui-row">
                        <div class="layui-col-md12">
                            <div class="layui-row layui-col-space10 layui-form-item">
                                <div class="layui-col-md12">
                                    <label class="layui-form-label">订阅手机号：</label>
                                    <div class="layui-input-block">
                                        <div class="custom-company-remind-open">
                                            <input type="checkbox" @{{if .m.IsOpenSubPhone   }} checked @{{end}}
                                                   value="1" name="IsOpenSubPhone" lay-filter="is_open_phone"
                                                   lay-skin="switch" lay-text="开启|关闭">
                                            <span>（开启后，触发订阅条件后，系统将会自动发送消息到指定手机中）</span>
                                        </div>
                                        <div class="is_phone_show">
                                            <input type="text" name="SubPhone" value="@{{.m.SubPhone }}"
                                                   lay-verify="sub_phone" lay-verType="tips" placeholder="请输入手机号"
                                                   autocomplete="off"
                                                   class="layui-input custom-company-remind-input">
                                            <label class="custom-company-remind-label">支持多个手机同时订阅，请使用,隔开</label>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-row layui-col-space10 layui-form-item">
                                <div class="layui-col-md12">
                                    <label class="layui-form-label">订阅邮箱：</label>
                                    <div class="layui-input-block">
                                        <div class="custom-company-remind-open">
                                            <input type="checkbox" @{{if .m.IsOpenSubEmail   }} checked @{{end}}
                                                   value="1" name="IsOpenSubEmail" lay-filter="is_open_email"
                                                   lay-skin="switch" lay-text="开启|关闭">
                                            <span>（开启后，触发订阅条件后，系统将会自动发送消息到指定邮箱中）</span>
                                        </div>
                                        <div class="is_email_show">
                                            <input type="text" name="SubEmail" value="@{{.m.SubEmail }}"
                                                   placeholder="请输入邮箱" lay-verify="sub_email" lay-verType="tips"
                                                   autocomplete="off" class="layui-input custom-company-remind-input">
                                            <label class="custom-company-remind-label">支持多个邮箱同时订阅，请使用,隔开</label>
                                        </div>

                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-row layui-col-space10 layui-form-item subscription_content">
                        <div class="layui-col-md11">
                            <label class="layui-form-label">订阅内容：</label>
                            <div class="layui-input-block">
                                <div class="custom-company-remind-conent">
                                    <div class="flex_item">
                                <span class="flex_item_title">
                                    审核通过
                                </span>
                                        <a class="flex_item_btn @{{if .m.SubContentCheck  }} active @{{end}}"
                                           id="sub_content_check">@{{if .m.SubContentCheck   }}退订@{{else}}订阅@{{end}}</a>
                                    </div>
                                    <div class="flex_item">
                                <span class="flex_item_title">
                                    已提交海关处理
                                </span>
                                        <a class="flex_item_btn @{{if .m.SubContentSubmit}}  active @{{end}}"
                                           id="sub_content_submit">@{{if .m.SubContentSubmit   }}退订@{{else}}订阅@{{end}}</a>
                                    </div>
                                    <div class="flex_item">
                                <span class="flex_item_title">
                                    驳回信息
                                </span>
                                        <a class="flex_item_btn @{{if .m.SubContentReject }} active @{{end}}"
                                           id="sub_content_reject">@{{if .m.SubContentReject   }}退订@{{else}}订阅@{{end}}</a>
                                    </div>
                                    <div class="flex_item">
                                <span class="flex_item_title">
                                    结关放行
                                </span>
                                        <a class="flex_item_btn @{{if .m.SubContentPass }} active @{{end}}"
                                           id="sub_content_pass">@{{if .m.SubContentPass   }}退订@{{else}}订阅@{{end}}</a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn custom-create_btn" lay-submit lay-filter="company_submit"
                                    type="button">
                                提 交
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>

@{{if .m.Id }}
<div class="layui-col-md12">
    <div class="layui-card">
        <div class="layui-card-body">
            <div class="custom-company-contacts_flex">
                <h1 class="new_title">联系人管理</h1>
                <button class="layui-btn custom-create_btn" id="contacts_new" type="button">
                    新建
                </button>
            </div>
            <table class="layui-hide" id="contacts_lists_new" lay-filter="contacts_lists_new"></table>
        </div>
    </div>
</div>

<script type="text/html" id="contacts_lists_toolbar">
    <a class="custom-edit" lay-event="edit">编辑</a>
    <a class="custom-delete" lay-event="del">删除</a>
</script>


<div class="layui-col-md12">
    <div class="layui-card">
        <div class="layui-card-body">
            <div class="custom-company-contacts_flex">
                <h1 class="new_title">外商公司管理</h1>
                <button class="layui-btn custom-create_btn" id="foreign_new" type="button">
                    新建
                </button>
            </div>
            <table class="layui-hide" id="foreign_lists_new" lay-filter="foreign_lists_new"></table>
        </div>
    </div>
</div>

<script type="text/html" id="foreign_lists_toolbar">
    <a class="custom-edit" lay-event="edit">编辑</a>
    <a class="custom-delete" lay-event="del">删除</a>
</script>

<div class="layui-col-md12">
    <div class="layui-card">
        <div class="layui-card-body">
            <div class="custom-company-contacts_flex">
                <h1 class="new_title">签章管理</h1>
                <button class="layui-btn custom-create_btn" id="seal_new" type="button">
                    上传
                </button>
            </div>
            <div id="seal_lists_new"></div>
        </div>
    </div>
</div>

<script type="text/html" id="seal_lists_templet">
    <div class="custom-company-seal_lists">
        @{{range $i,$v := .m.CompanySeals }}
    <div class="seal_flex">
        <div class="seal_flex_img">
            <img src="@{{ $v.Url }}">
            <div class="seal_flex_edit">
                <a class="seal_flex_edit_btn" data-id="@{{$v.Id}}">编辑</a>
                <a class="seal_flex_edit_del" data-id="@{{$v.Id}}">删除</a>
            </div>
        </div>
        <p>@{{ $v.SealName }}</p>
    </div>
    @{{end }}
    </div>
</script>

@{{end}}